package com.lin.fengxiu.model;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;
import sun.misc.ClassLoaderUtil;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

/**
 * @ClassName Category
 * @Description TODO
 * @Author wushaopei
 * @Date 2021/3/17 6:30
 * @Version 1.0
 */
@Entity
@Setter
@Getter
@Where(clause = "delete_time is null and online = 1")
public class Category extends BaseEntity{
    @Id
    private Long id;
    private String name;
    private String description;
    private Boolean isRoot;
    private Long parentId;
    private String img;
    private Long index;
    private Long online;
    private Long level;

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "coupon_category",
            joinColumns = @JoinColumn(name = "category_id"),
            inverseJoinColumns = @JoinColumn(name = "coupon_id"))
    private List<Coupon> couponList;

}
